<div class="wyszukiwanie-ofert-form_w">

<form id="wyszukaj-oferty" action="{$smarty.const.HTTP_URL}{$settings_katalog_ta.mainpage|default:$page},,show_category,0.html" method="post">
<div>
	<div class="skinnedSelect_w">
		<select name="tacID1" id="tacID1">
			<option value="" selected="selected">Category</option>
		{section name=id loop=$kat0}
			<option value="{$kat0[id].tacID}">{$kat0[id].tacNazwa}</option>
		{/section}
		</select>
	</div>
</div>
<div>
	<div class="skinnedSelect_w">
		<select name="tacID2" id="tacID2">
			<option value="" selected="selected">County/Town</option>
		</select>
	</div>
</div>
<div>
	<div class="skinnedSelect_w">
		<select name="tacID3" id="tacID3">
			<option value="" selected="selected">Locality</option>
		</select>
	</div>
</div>
<br/><br/>
<div>
	<div class="skinnedSelect_w">
		<select name="tacID4" id="tacID4">
			<option value="" selected="selected">Cuisine Types</option>
			{dispatcher->handleEvent v=KatalogTA,wyswietlListeSlownikaKuchniDlaWyszukiwarki }
		</select>
	</div>
</div>	
<div>
	<div class="skinnedSelect_w">
		<input name="tacID5" id="tacID5" value="" title="{$__cl.wyszukaj_wg_slowa_kluczowego}"/>
	</div>
</div>	

<a class="button_szukaj_ofert_w" id="button_szukaj_ofert" href="#" title="{$__cl.wyszukaj_produkty_katalogu}" align="middle" >{$__cl.wyszukaj_produkty_katalogu}</a> 

</form>
</div>
{literal}
<script>
$(document).ready(function(){
	$("#tacID1").change(function () {		
	    $("#tacID1 option:selected").each(function () {
	    	$("#text1").attr("value",$(this).text());
	    	$.get("{/literal}{$smarty.const.HTTP_URL}{$settings_katalog_ta.mainpage|default:$page}{literal},KatalogTA,wyswietlSubKategorieDlaKategoriiDwaPoziomy,"+$(this).attr("value")+".html", function(data){
	    		  $("#tacID2").html('<option value="" selected="selected">County/Town</option>'+data);
	    		  $("#tacID3").html('<option value="" selected="selected">Locality</option>');
	    	});        
	    });
	});

	$("#tacID2").change(function () {		
	    $("#tacID2 option:selected").each(function () {
	    	$("#text2").attr("value",$(this).text());
	    	$.get("{/literal}{$smarty.const.HTTP_URL}{$settings_katalog_ta.mainpage|default:$page}{literal},KatalogTA,wyswietlSubKategorieDlaKategoriiDwaPoziomy,"+$(this).attr("value")+".html", function(data){
	    		  $("#tacID3").html('<option value="" selected="selected">Locality</option>'+data);	    		  
	    	});
        });
	});

	$("#tacID3").change(function () {		
	    $("#tacID3 option:selected").each(function () {
        });
	});

	$("#button_szukaj_ofert").click(function() {
		if($.trim($("#tacID3").attr("value")).length > 0  ){
			document.location='{/literal}{$smarty.const.HTTP_URL}{$settings_katalog_ta.mainpage|default:$page}{literal},,show_category,'+$("#tacID3").attr("value")+'.html?s1='+$.trim($("#tacID4").attr("value"))+'&s2='+$("#tacID5").attr("value");
		}else if ( $.trim($("#tacID2").attr("value")).length > 0  ) { 
			document.location='{/literal}{$smarty.const.HTTP_URL}{$settings_katalog_ta.mainpage|default:$page}{literal},,show_category,'+$("#tacID2").attr("value")+'.html?s1='+$.trim($("#tacID4").attr("value"))+'&s2='+$("#tacID5").attr("value");
		}else if ($.trim($("#tacID1").attr("value")).length > 0 ){
			document.location='{/literal}{$smarty.const.HTTP_URL}{$settings_katalog_ta.mainpage|default:$page}{literal},,show_category,'+$("#tacID1").attr("value")+'.html?s1='+$.trim($("#tacID4").attr("value"))+'&s2='+$("#tacID5").attr("value");
		}else{
			alert("Please - select options to search.");
		}
	});
});

</script>
{/literal}
